package com.smallcr.utils;

import com.smallcr.constant.Constants;

public class PassWordUtil {
	/**
	 * @param userName
	 * @param password
	 * @return
	 */
	public static String generalPassword(final String userName, final String password) {
		if (userName.indexOf("@") != -1) {
			String shortUserName = userName.substring(0, userName.indexOf("@"));
			return MD5Util.string2MD5(shortUserName.toLowerCase() + Constants.USER_KEY + MD5Util.string2MD5(password));
		} else {
			return MD5Util.string2MD5(userName.toLowerCase() + Constants.USER_KEY + MD5Util.string2MD5(password));
		}
	}
}
